package core;

import fileoperation.FileDeletion;
import repository.Repository;
import java.io.File;
import java.io.IOException;
import gitobject.*;

public class JitHash {
    /**
     * serialize a file or a dir and return its hash
     */
    public static void hash(String filename) throws IOException {
        try {
            File file = new File(filename);
            if(file.isFile()){
                Blob b = new Blob(file);
                System.out.println(b.getKey());
            }
            if(file.isDirectory()){
                Tree t = new Tree(file);
                System.out.println(t.getKey());
            }
        }
        catch (Exception e){
            e.printStackTrace();
        }
    }
}
